package com.goldenlight.fvms.manager.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 生产生活车辆申请信息表
 * </p>
 *
 * @author luocx
 * @since 2018-12-09
 */
@ExcelTarget("employFreeEntity")
@TableName("tb_product_free_apply")
@Data
public class ProductFreeApply implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 序号
     */
    @Excel(name = "序号", height = 20, width = 30, isImportField = "applyId")
    @TableId(value = "APPLY_ID", type = IdType.AUTO)
    private Long applyId;

    /**
     * 车牌号
     */
    @Excel(name = "车牌号", height = 20, width = 30, isImportField = "carNum")
    @TableField("CAR_NUM")
    private String carNum;

    /**
     * 厂牌
     */
    @Excel(name = "厂牌", height = 20, width = 30, isImportField = "carLabel")
    @TableField("CAR_LABEL")
    private String carLabel;

    /**
     * 车牌颜色
     */
    @Excel(name = "车牌颜色", height = 20, width = 30, isImportField = "carColor")
    @TableField("CAR_COLOR")
    private String carColor;

    /**
     * 车型（收费车型）
     */
    @Excel(name = "车型（收费车型）", height = 20, width = 30, isImportField = "carModel")
    @TableField("CAR_MODEL")
    private String carModel;

    /**
     * 申请单位
     */
    @Excel(name = "申请单位", height = 20, width = 30, isImportField = "carApplyUnit")
    @TableField("CAR_APPLY_UNIT")
    private String carApplyUnit;

    /**
     * 行驶本登记单位
     */
    @Excel(name = "行驶本登记单位", height = 20, width = 30, isImportField = "carDriveUnit")
    @TableField("CAR_DRIVE_UNIT")
    private String carDriveUnit;

    /**
     * 通行区间
     */
    @Excel(name = "通行区间", height = 20, width = 30, isImportField = "carPassInterval")
    @TableField("CAR_PASS_INTERVAL")
    private String carPassInterval;

    /**
     * 业务类型
     */
    @Excel(name = "业务类型", height = 20, width = 30, isImportField = "carBussType")
    @TableField("CAR_BUSS_TYPE")
    private String carBussType;

    /**
     * 车辆类型1-养护生产（路网），2-生产生活（路网），3-养护生产（区间），4-生产生活（区间）
     */
    @Excel(name = "车类型", height = 20, width = 30, isImportField = "carType",replace = { "养护生产（路网）_1", "生产生活（路网）_2","养护生产（区间）_3," ,"生产生活（区间）_4"})
    @TableField("CAR_TYPE")
    private Long carType;

    /**
     * 路类型
     */
//    @Excel(name = "路类型", height = 20, width = 30, isImportField = "roadType")
//    @TableField("ROAD_TYPE")
    private Long roadType;

    /**
     * 备注
     */
    @Excel(name = "备注", height = 20, width = 30, isImportField = "carNote")
    @TableField("CAR_NOTE")
    private String carNote;
    /**
     * 时间戳
     */
    @TableField("TIME_STAMP")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date timeStamp;
    /**
     * 内部版本号
     */
    @TableField("BUILD_VERSION")
    private String buildVersion;

    /**
     * 条数
     * 汇总查询用
     */
    @TableField(value="count",exist = false)
    private Integer count;



    public String getCondition(){
    return this.carNum+"-"+this.carApplyUnit;
    }
    public String getJudgeCondition(){
        return this.carNum+"-"+this.carApplyUnit+"-"+this.carBussType;
    }

    @Override
    public String toString() {
        return "ProductFreeApply{" +
                "applyId=" + applyId +
                ", carNum='" + carNum + '\'' +
                ", carLabel='" + carLabel + '\'' +
                ", carColor='" + carColor + '\'' +
                ", carModel='" + carModel + '\'' +
                ", carApplyUnit='" + carApplyUnit + '\'' +
                ", carDriveUnit='" + carDriveUnit + '\'' +
                ", carPassInterval='" + carPassInterval + '\'' +
                ", carBussType='" + carBussType + '\'' +
                ", carType=" + carType +
                ", roadType=" + roadType +
                ", carNote='" + carNote + '\'' +
                ", timeStamp=" + timeStamp +
                ", buildVersion=" + buildVersion +
                '}';
    }

//    @Override
//    public boolean equals(Object obj) {
//        final ProductFreeApply product=(ProductFreeApply)obj;
//        return this.carNum.equals(product.carNum)&&this.carApplyUnit.equals(product.carApplyUnit)&&this.carBussType.equals(product.carBussType);
//    }
//
//    @Override
//    public int hashCode() {
//        return (this.getCarNum().toString()+this.getCarApplyUnit().toString()+this.getCarBussType().toString()).hashCode();
//    }
}
